/**
 * Created by CHENRI4 on 10/19/2016.
 */
Ext.define('sso.admin.user.view.UserGridView',{
    extend:'Ext.grid.Panel',
    alias:'widget.UserGrid',
    id:'userGird',
    title:'Admin - User',
    store:Ext.create('sso.admin.user.store.UserStore'),
    emptyText:'No record found',
    border:true,
    cls: 'content',
    stateful: true,
    columnLines: true,
    autoRender: true,
    scroll: 'vertical',
    enableColumnMove: false,
    enableColumnHide: false,
    viewConfig : {
        forceFit: true,
        minHeight : 300,
        deferEmptyText: false,
        enableTextSelection: true,
        scrollable :'y'
    },
    initComponent : function () {
        var me = this;
        me.height = Ext.getBody().getHeight();
        Ext.applyIf(me,{
            columns: [
            	{
                    xtype: 'rownumberer',
                    align: 'center',
                    text: "No.",
                    minWidth:42
                },
                // {
                //     text:'active',
                //     flex:0.2,
                //     xtype:'checkcolumn',
                //     minWidth:57,
                //     dataIndex:'active',
                //     hidden:true,
                //     sortable:false,
                //     listeners: {
                //         checkchange: function (column, recordIndex, checked) {
                //             console.log(checked);
                //         }
                //     }
                // },
                {
                    flex:1,
                    dataIndex: 'uId',
                    text: 'User Id',
                },
                {
                    flex:1,
                    dataIndex: 'name',
                    text: 'Name',
                },
                {
                    flex:1,
                    dataIndex: 'phone',
                    text: 'Phone',
                },
                {
                    flex:1,
                    dataIndex:'createTime',
                    text:'Create Time',
                    renderer:function (value) {
                        return Ext.Date.format(value, 'Y-m-d H:i:s.u')
                    }
                }
            ]
        });
        me.callParent(arguments);
    },
    dockedItems : [
        {
            xtype: 'panel',
            hidden:'true',
            dock: 'bottom',
            style:{
                'border-right':'1px solid',
                'border-left':'1px solid',
            },
            layout: {
                type: 'hbox',
                align: 'stretch',
                pack: 'center'
            },
            items: [
                {
                    xtype: 'button',
                    id: 'btnAddUser',
                    text: 'Add',
                    margin: '5 0 10 0',
                }
            ]
        },
        {
            xtype: 'pagingtoolbar',
            id:'UserPagingToolBar',
            dock: 'bottom',
            border:true,
            // style:{
            //     'border-bottom-color':'#157fcc',
            // },
            width: 360,
            store : this.store,
            displayInfo: true
        },

    ],
    tbar: [{
            text: 'Sync User',
            id: 'btnUserSync',
        },
        {
            id : 'btnDelUser',
            text : 'Delete',
            disabled: true
        }],

})